package com.nguyenbb.ball;

import java.awt.Color;
import java.util.ArrayList;
import java.util.Random;

import javax.swing.JFrame;
/**
 * Main Program for running the bouncing ball as a standalone application.
 */
public class Main {
   // Entry main program
   public static void main(String[] args) {
	   
	   final int canvasWidth = 640;
	   final int canvasHeight = 480;
      // Run UI in the Event Dispatcher Thread (EDT), instead of Main thread
      javax.swing.SwingUtilities.invokeLater(new Runnable() {
         public void run() {
//        	ArrayList<Ball> ballList = new ArrayList<Ball>();
//        	
//        	for (int i = 0; i < 20 ; i++) {
//        		Random rand = new Random();
//        		int radius = 20;
//        		int x = rand.nextInt(canvasWidth - radius * 2 - 20) + radius + 10;
//        		int y = rand.nextInt(canvasHeight - radius * 2 - 20) + radius + 10;
//        		int speed = 5;
//        		int angleInDegree = rand.nextInt(360);
//        		ballList.add(new Ball(x, y, radius, speed, angleInDegree, Color.BLUE));
//        	}
        	 
            JFrame frame = new JFrame("A World of Balls");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setContentPane(new BallWorld(canvasWidth, canvasHeight)); // BallWorld is a JPanel
            frame.pack();            // Preferred size of BallWorld
            frame.setVisible(true);  // Show it
         }
      });
   }
}
